package org.anupta.realm.server.realm.packet.login;

import org.anupta.realm.main.Main;
import org.anupta.realm.server.realm.client.RealmClient;
import org.anupta.realm.server.realm.client.RealmClient.State;
import org.anupta.realm.server.realm.packet.RealmPacket;
import org.anupta.realm.server.realm.packet.login.answer.RequiredVersion;
import org.anupta.realm.utils.others.Config;

public class Version extends RealmPacket {

	public Version(RealmClient client, String message) {
		super(client, message);
		doPacket();
	}

	@Override
	public void unpack() {//Useless to unpack here ^^
	}
	
	@Override
	public void pack() {
	}

	@Override
	public void doPacket() {
		if(!(packetIn.toString().equalsIgnoreCase(Config.VERSION))){
			new RequiredVersion(client);
			Main.out.println(new StringBuilder("Bad version : ").append(client.getIp()).toString());
		}
		client.setState(State.LOGIN);
	}
}
